import $ from "jquery";
import {url} from "../../util/config";
import login from "../login";
import {message} from "antd";

function getNewLogin() {
    return userSubList()
}

export default function userSubList() {

    let token = localStorage.getItem("token")

    let status;

    $.ajax({
        async:false,
        headers: {
            'Accept': "application/json",
            'Authorization': token
        },
        url: url.api_url+`subscribe/userSubList`,
        type: 'get',
        success: function (result) {
            status = result.result
            if(status=="Token過期請重新登錄"){
                login(localStorage.getItem("account"), localStorage.getItem("password"));
                status = getNewLogin()
            }
        },
        error:function (error) {
            status = "error"
            message.error("请求异常");
        }
    })
    return status
}

// [
//     {
//         Id		// id
//         Type	//类型
//         Name	//名称
//         updateDate	//订阅表的updateDate，获取最新时间
//     }…
// ]

